<?php

namespace App\Service;

use Dreamcat\ConfigClient\ConfigCenterListener;
use Dreamcat\ConfigClient\ConfigCenterReadProcessInterface;
use Dreamcat\ConfigClient\ConfigSaverInterface;

/**
 * -
 * @author vijay
 */
class ConfigCenterService
{
    /** @var ConfigCenterReadProcessInterface */
    private $configCenterReadProcess;
    /** @var ConfigCenterListener */
    private $configCenterListener;
    /** @var ConfigSaverInterface */
    private $configSaver;

    public function __construct(
        ConfigCenterReadProcessInterface $configCenterReadProcess,
        ConfigCenterListener $configCenterListener,
        ConfigSaverInterface $configSaver
    ) {
        $this->configCenterReadProcess = $configCenterReadProcess;
        $this->configCenterListener = $configCenterListener;
        $this->configSaver = $configSaver;
    }

    public function readConfig()
    {
        $this->configCenterReadProcess
            ->setConfigSaver($this->configSaver)
            ->setConfigServerLintener($this->configCenterListener)
            ->readConfig();
    }
}

# end of file
